#@layout()
#define head()
<script type="text/javascript" src="#(CONTEXT_PATH??)/static/js/vue.min.js" ></script>
<script>
function reg(){
	$.post("#(CONTEXT_PATH??)/user/save",{
		id:#(user.id),
		username:$('#username').val(),
		password:$('#password').val(),
		name:$("#name").val(),
		birthday:$("#birthday").val(),
		position:$('#position').val()
	},function(data){
		if(data=='suc'){
			$.toast("保存成功！");
		}
	});
}

//跳转到vip页面
function vip(){
	app.vip = true;
}

//跳转到支付界面
function pay(){
	$.post("#(CONTEXT_PATH??)/m/upVip",{tmp:new Date()},function(data){
		if(data=='suc'){
			$.toast("保存成功！",'text');
			app.is_vip = true;
			app.vip = false;
		}else{
			$.toast("升级失败！",'text');
		}
	});
}

var app = null;
$(function(){
	app = new Vue({
		  el: '#app',
		  data: {
		    message: 'Hello Vue!',
		    vip:false,
		    is_vip:#(user.is_vip??'0')
		  },
		  methods:{
		  }
	});
});
</script>
#end

#define content()
<div>
	我的信息
</div>
<div class="weui-cells weui-cells_form" id="app">
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">用户名</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" id="username" value="#(user.username??)" type="text"  placeholder="请输入">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" id="password" type="password" value="#(user.password??)"  placeholder="请输入">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" id="name"  value="#(user.name??)" type="text"  placeholder="请输入">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">积分</label></div>
    <div class="weui-cell__bd" style="line-height:100%;">
      #(user.score??)
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">生日</label></div>
    <div class="weui-cell__bd">
      <input class="weui-input" id="birthday"  value="#(user.birthday??)" type="date"  placeholder="请输入">
    </div>
  </div>
  <div class="weui-cell">
    <div class="weui-cell__hd"><label class="weui-label">类型</label></div>
    <div class="weui-cell__bd">
      <div v-if="is_vip">VIP会员</div>
      <div v-if="! is_vip">普通会员</div>
    </div>
  </div>
  <div style="display:flex;justify-content:center;">
	  <div style="width:80%;algin-self:center;">
	  
	 	<a href="javascript:reg();" class="weui-btn weui-btn_primary btn">保存</a>
	  	<a href="/m/logout" class="weui-btn weui-btn_primary btn">退出</a>
	 	<a href="#(CONTEXT_PATH??)/m/saleOrder" class="weui-btn weui-btn_primary btn">我的订单</a>
	 	<a href="#(CONTEXT_PATH??)/m/myYuyue" class="weui-btn weui-btn_primary btn">我的预约</a>
	  </div>
  </div>
  
</div>

#end

